// Package aliyun
// Created by GoLand
// @User: lenora
// @Date: 2023/12/14
// @Time: 14:31

package aliyun

import dysmsapi "github.com/alibabacloud-go/dysmsapi-20170525/v3/client"

type Service struct {
	client   *dysmsapi.Client
	signName string
}

func NewService(client *dysmsapi.Client, signName string) *Service {
	return &Service{
		client:   client,
		signName: signName,
	}
}

func (s *Service) Send(tplId string, args []string, phone string) {
	request := new(dysmsapi.SendSmsRequest)
	request.SetPhoneNumbers(phone)
	request.SetSignName(s.signName)
	request.SetTemplateCode(tplId)
	//TODO:腾讯云与阿里云传值方式不同,需要考虑如何做成通用情况
	//request.SetTemplateParam([])
	s.client.SendSms(request)
}
